Computer Science
Computer Architecture
Key abbreviations
- CPU: Central Processing Unit
- ALU: Arithmetic Logic Unit
- CU: Control Unit
- MAR: Memory Address Register
- MDR: Memory Data Register
Central Processing Unit
Definition: The key component of a computer system which contains the circuitry necessary to fetch, decode, and execute program instructions from and to main memory (RAM).
Function of the ALU
- Part of the CPU that does all the arithmetic (+/-) and logical (AND/OR) calculations (Perform logical comparisons)
- Sometimes an ALU is referred to as a "core," hence computers with dual-core technology have two ALUs to process two calculations simultaneously.
Function of the CU
- It handles the loading of new commands into the CPU and decoding of these commands.
- It directs the data flow and the operation of the ALU.
CPU and its own memory
Registers: They are small, very fast circuits that store intermediate values from calculations or instructions inside the CPU. There are many registers, but the most important ones are:
1. MAR
- Connected to the address bus
- Contains memory address
- Function: To contain the RAM address of the next instruction.
2. MDR
- Connected to the data bus
- Holds the data that will be written to the RAM or that was read from RAM
Relationship between MDR and MAR
The MAR gives the address the data of the MDR will be read from or written to.
Cache
- Definition: A type of small high-speed memory inside the CPU used to hold frequently used data (determined by the operating system) so that the CPU needs to access the much slower RAM less frequently. It is considered primary memory.
- Cache levels: There are different caches, one which is quicker/slower, larger/smaller, etc. (The quickest is the smallest and closest to the CPU, and the slowest is the biggest and most far away from the CPU).
Machine Instruction Cycle (fetch-decode-execute)
The basic operation of a computer is called the ‘fetch-decode-execute’ cycle (also called the ‘machine cycle’). The computer fetches the instruction from its memory and then executes it. This is done repeatedly from when the computer is booted up to when it is shut down.
Step 1: Fetching the instruction
The first step in the fetch-execute cycle is fetching the instruction. The CPU fetches this from the main memory (RAM) and stores it in the CPU temporary memory called the registers.
Step 2: Decoding the instruction
Once the instruction has been fetched, the CPU will need to understand the instruction to action it. This is called decoding.
Step 3: Executing the instruction
When the instruction has been decoded, the CPU can carry out the action that is needed. This is called executing the instruction. The CPU is designed to understand a set of instructions - the instruction set.
Exam Tip
You are required to describe the role of the data and address busses in the cycle. Think about what information they carry from where to where and what they connect to at each end.
Why do we need storage?
Processing is done in the CPU (storage in the CPU; registers and cache); it has no permanent storage, only registers. Data is stored in RAM; however, RAM is volatile (loses its contents if power is lost). Data needs to be stored on persistent storage, like non-volatile storage (e.g., HDD, SSD) to store things permanently.
Main functions of an operating system
- Provides a user interface: A link between the user and the computer hardware (features like Windows, Icons, Menu, Pointer, etc.)
- Memory management
- Peripheral management
- Allows multitasking
- Provides security